<!DOCTYPE html>

<html lang="en">



<head>

	<meta charset="UTF-8">

	<title>入场签到</title>

	<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no"

		name="viewport">

	<link rel="stylesheet" href="css/reset.css">

	<link rel="stylesheet" href="css/bosscoach.css">

	<link rel="stylesheet" href="css/membership.css">

	<link rel="stylesheet" href="css/reset.css">

	<link rel="stylesheet" href="css/bossIndex.css">

	<link rel="stylesheet" href="css/flexible.css">

	<link rel="stylesheet" href="css/vant.css">

	<script src="js/vue/vue.js"></script>

	<script src="js/vue/axios.js"></script>

	<script src="js/vue/vant.js"></script>

	<script src="js/vue/MD5.js"></script>

	<script src="js/vue/qs.js"></script>

	<script src="js/glabe.js"></script>

	<script src="js/fontsize.js"></script>

	<style>

		.dyyd{

			width: 0.76rem;

			height: 0.26rem;

			background: #0E9CFA;

			color: #fff;

			text-align: center;

			line-height: 0.26rem;

			transform: translateY(-50%);

			border-radius: 0.02rem;

			font-size: 0.14rem;

			margin-left: 2rem;

		}

		.marginbottom15{

			margin-bottom: .1rem;

			font-size: .12rem;

		}

		.gygh{

			display:inline-block;

			width:40%;

			font-size: 0.12rem;

			margin-left: 0.2rem;

		}

	</style>

</head>



<body>

	<div class="container_box" id="app" style="padding-top:0rem;">

		<header>

			<div class="search bar3" style="width:100%;">

				<form @submit.prevent action="#">

					<input style="width: 100%;" @keyup.enter.native="search" v-model="from.phone" type="search" placeholder="会员姓名/手机号码">

					<button @click="search" type="text"><img src="images/search.png"></button>

				</form>

			</div>

		</header>

		<template>

			<div v-if="isSearch=='1'" style="margin-top: .1rem;" class="group_details group_details_state clearfix" v-for="(item,index) in dataList" :key="item.id">

				<div v-if="item.SignType=='1'">

					<div class="fl head_card">

						<div class="spinning_img" style="line-height: .2rem;text-align: center;font-size:.13rem;">{{item.Username}}</div>

					</div>

					<div class="spinning_txt fl content_right" style="margin-top:0px;padding-top: 0rem;">

						<p class="margin_bottom" style="display: flex;align-items: center;margin-bottom: 0.05rem;">

							<span style="font-size: 0.12rem;">{{item.Cardname}}</span>

						</p>

						<p style="margin-bottom: 0.05rem;">

							<span style="font-size: 0.14rem;">入场时间:</span>

							<span class="spinning_name" style="font-size: .12rem;">{{item.SingIn}}</span>

						</p>

						<p style="margin-bottom: 0rem;">

							<span style="font-size: 0.14rem;">更衣柜号:</span>

							<span class="spinning_name" style="font-size: 0.12rem;width: 0.2rem;display: inline-block;">{{item.Wardrobe}}</span>

						</p>

						<div class="dyy" @click="qcClick(item.signID)">签出</div>

					</div>

				</div>

				<div v-else>

					<div class="fl head_card">

						<div   class="spinning_img" style="line-height: .2rem;text-align:center;font-size:0.13rem;">{{item.Username}}</div>

					</div>

					<div class="spinning_txt fl content_right" style="margin-top:0px;padding-top: 0rem;">

						<p class="margin_bottom" style="display: flex;align-items: center;margin-bottom: 0.05rem;">

							<span style="font-size: 0.12rem;">{{item.Cardname}}</span>

						</p>

						<p style="margin-bottom: 0.05rem;">

							<span style="font-size: 0.14rem;">入场时间:</span>

							<span class="spinning_name" style="font-size: 0.12rem;">{{item.SingIn}}</span>

							<span style="font-size: 0.14rem;">离场时间:</span>

							<span class="spinning_name" style="font-size: 0.12rem;">{{item.SingOut}}</span>

						</p>

						<p style="margin-bottom: 0rem;">

							<span style="font-size: 0.14rem;">更衣柜号:</span>

							<span class="spinning_name" style="font-size: 0.12rem;width: 0.3rem;display: inline-block;">{{item.Wardrobe}}</span>

							<span style="margin-left:0.18rem;font-size:0.14rem">入场时长:</span>

							<span class="spinning_name" style="font-size: 0.12rem;">{{item.SingOutTime}}</span>

						</p>

					</div>

				</div>

			</div>

			<div v-if="isSearch=='2'" style="margin-top: .1rem;" class="group_details group_details_state clearfix">

				<div class="fl head_card">

					<img :src="user_info.Picurl" alt="" class="spinning_img">

				</div>

				<div class="spinning_txt fl content_right" style="margin-top:.2rem;padding-top: 0rem;padding-bottom: .3rem;">

					<p class="margin_bottom" style="display: flex;align-items: center;margin-bottom: 0.05rem;">

						<span style="font-size: 0.12rem;">{{user_info.Username}}</span>

						<span style="font-size: 0.14rem;margin-left: 0.1rem;">更衣柜号</span>

						<span class="gygh">

						<input style="width:100%;" v-model="qrFrom.Wardrobe" placeholder="更衣柜号"/>

						</span>

					</p>

				</div>

				<div style="margin-top:0.3rem;">

					<div class="marginbottom15">

						<span style="font-size: 0.12rem;">{{card_infoMess.Cardname}}：</span>

						<span style="font-size: 0.12rem;">{{card_infoMess.balance}}</span>

						<select v-model="qrFrom.Cid" style="float: right;" @change="selectCard">

							<option v-for="itemds in card_info" :value="itemds.Cid">

								{{itemds.Cardname}}

							</option>

						</select>

					</div>

					<div  class="marginbottom15">

						<span style="font-size: 0.14rem;">办理时间：</span>

						<span style="font-size: 0.12rem;">{{user_info.Addtime}}</span>

					</div>

					<div  class="marginbottom15">

						<span style="font-size: 0.14rem;">手机号码：</span>

						<span style="font-size: 0.12rem;">{{user_info.Phone}}</span>

					</div>

					<div style="overflow: hidden;">

						<div style="float: left;font-size:0.12rem">共同持卡人：</div>

						<van-radio-group style="float: left;" v-model="qrFrom.Cardholderid" direction="horizontal">

							<van-radio  v-for="items in card_infoMess.Cardholder" :name="items.id" 

							style="float:left;font-size: 12px;margin-right: 10px;">{{items.Name}}</van-radio>

						  </van-radio-group>

					</div>

					<div style="margin-top:.2rem;">

						<div  class="dyyd" @click="qrClick">签入</div>

					</div>

				</div>

			</div>

		</template>

	</div>

</body>

<script>

	var app = new Vue({

		el: '#app',

		data: {

			dataList:[], //会员列表数据

			from:{

				phone:''

			},

			qrFrom:{

				Uid:'',

				Cid:'',

				Csid:'',

				Wardrobe:'',

				Cardholderid:''

			},

			user_info:{},

			card_info:[],

			cardType:'',

			card_infoMess:{},

			isSearch:'1'

			

		},

		created() {

			this.getList()

		},

		methods: {

			getList(){

				axios.get('mobileapi/boss/sign.php?act=todaySingAll').then(res => {

					console.log(res.data)

					let { msg, code} = res.data

						if (code != 200) {

							vant.Toast(msg)

						} else {

							data=res.data

							if(data!=[]){

								this.dataList=data.data.list

								// this.user_info=data.data.user_info

								// if(this.user_info.Picurl==""||this.user_info.Picurl==null){

								// 	this.user_info.Picurl='images/moren.png'

								// }

							}

						}

				}).catch(err => {

					//vant.Toast('请求发送失败')

				})

			},

			//搜索的

			search(){

				this.qrFrom.Cardholderid=''

				const params=this.from

				axios.get('mobileapi/boss/sign.php?act=workSign',{params:params}).then(res => {

					let { msg, code} = res.data

						if (code != 200) {

							this.isSearch='1'

							vant.Toast(msg)

						} else {

							this.isSearch='2'

							data=res.data

							this.card_info=data.data.card_info

							this.cardType=this.card_info[0].Cid

							this.user_info=data.data.user_info

							this.card_infoMess=this.card_info[0]

							this.qrFrom.Uid=this.user_info.id

							this.qrFrom.Csid=this.card_info[0].Csid

							this.qrFrom.Cid=this.card_info[0].Cid

							if(this.user_info.Picurl==""||this.user_info.Picurl==null){

									this.user_info.Picurl='images/moren.png'

							}

						}

				}).catch(err => {

					vant.Toast('请求发送失败，请重试')

				})

			},

			info(index,uid){

				window.location.href=`curriculum_t_yue.html?uid=${uid}`

			},

			//签入

			qrClick(){

				let from=JSON.stringify(this.qrFrom)

				let sign=md5(from)

				const params={

					from:from,

					sign:sign

				}

				getVs()

				axios.post('/mobileapi/boss/sign.php?act=workSignIn',Qs.stringify(params)).then(data =>{

					console.log(data.data)

					let { msg, code,user} = data.data

						if (code !== 200) {

							window.vant.Toast.fail(msg)

						} else {

							window.vant.Toast.success('签入成功')

							this.isSearch='1'

							this.getList()

						}

					}).catch(function (error) {

						console.log(error); 

				})

			},

			//签出

			qcClick(id){

				let from={

					signID:id

				}

				from=JSON.stringify(from)

				let sign=md5(from)

				const params={

					from:from,

					sign:sign

				}

				getVs()

				axios.post('/mobileapi/boss/sign.php?act=signOutGo',Qs.stringify(params)).then(data =>{

					console.log(data.data)

					let { msg, code,user} = data.data

						if (code !== 200) {

							window.vant.Toast.fail(msg)

						} else {

							window.vant.Toast.success('签出成功')

							this.getList()

						}

					}).catch(function (error) {

						console.log(error); 

				})

			},

			//选择不同的切换共同持卡人

			selectCard(){

				this.qrFrom.Cardholderid=''

				this.getCard()

			},

			//重新获取卡列表

			getCard(){

				this.isSearch='2'

				const params=this.from

				axios.get('mobileapi/boss/sign.php?act=workSign',{params:params}).then(res => {

					let { msg, code} = res.data

						if (code != 200) {

							vant.Toast(msg)

						} else {

							data=res.data

							this.card_info=data.data.card_info

							for(let i in this.card_info){

								if(this.card_info[i].Cid==this.qrFrom.Cid){

									this.card_infoMess.Cardname=this.card_info[i].Cardname

									this.qrFrom.Csid=this.card_info[i].Csid

									this.qrFrom.Cid=this.card_info[i].Cid

									this.card_infoMess.balance=this.card_info[i].balance

									this.card_infoMess.Cardholder=this.card_info[0].Cardholder

									this.card_infoMess.Signnum=this.card_info[0].Signnum

									this.card_infoMess.Signtime=this.card_info[0].Signtime

									this.card_infoMess.Cardholder=this.card_info[i].Cardholder

								}

							}

						}

				}).catch(err => {

					vant.Toast('请求发送失败，请重试')

				})

			}

		}

	})

</script>



</html>